from django.shortcuts import HttpResponseRedirect


try:
    from django.utils.deprecation import MiddlewareMixin
except ImportError:
    MiddlewareMixin = object


class SimpleMiddleware(MiddlewareMixin):
    def process_request(self,request):
        if request.path != '/loginPage/' and request.path != '/login/' and request.path != '/registerPage/' and request.path != '/register/':
            if request.session.get('userId') is None:
                return HttpResponseRedirect('/loginPage');
            else:
                pass;